package com.wanmait.gohome.controller.manage;

import com.github.pagehelper.PageInfo;
import com.wanmait.gohome.pojo.Information;
import com.wanmait.gohome.pojo.Userinfo;
import com.wanmait.gohome.service.InformationService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

//遗失者信息管理
@Controller
@RequestMapping("/manage")
public class LoserController {
    @Resource
    private InformationService informationService;
    @RequestMapping("/show/loser")
    public void loser()
    {

    }
    @RequestMapping("/ajaxJsp/losershow")
    public ModelAndView losershow()
    {
        PageInfo pageInfo  = informationService.findPage();
        ModelAndView mv = new ModelAndView();
        mv.addObject("pageInfo",pageInfo);
        return mv;
    }
    @RequestMapping("/ajaxJsp/loserdetails")
    public ModelAndView loserdetails(Information information)
    {
        Information information1  = informationService.loserdetails(information);
        ModelAndView mv = new ModelAndView();
        mv.addObject("information1",information1);
        return  mv;
    }
    @RequestMapping("/ajaxJsp/lookupType")
    public ModelAndView lookupType(Information information)
    {
        Integer lostTypeId =information.getLostTypeId();
        ModelAndView mv = new ModelAndView();
         PageInfo pageInfo = informationService.lookupTypePage(information);
         mv.addObject("pageInfo",pageInfo);
         mv.addObject("lostTypeId",lostTypeId);
         return  mv;
    }
    @RequestMapping("/ajaxJsp/auditShow")
    public ModelAndView auditShow()
    {
        ModelAndView mv = new ModelAndView();
        PageInfo pageInfo=  informationService.auditShow();
        mv.addObject("pageInfo",pageInfo);
        return  mv;
    }
    //条件查找显示
    @RequestMapping("/ajaxJsp/findLoserShow")
    public ModelAndView findLoserShow(String name)
    {
        PageInfo<Information> pageInfo  =  informationService.findLoserShow(name);
        ModelAndView mv = new ModelAndView();
        mv.addObject("pageInfo",pageInfo);
        mv.addObject("name",name);
        return mv;
    }
    //审核通过
    @ResponseBody
    @RequestMapping("/show/verified")
    public void verified(Information information)
    {
        informationService.updateStateNable(information);

    }


}
